package com.libweb.model.dao;

import java.sql.Connection;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

public class ConnectionHelper {
	
	public static Connection getConnection() {
			try {
			Context initContext = new InitialContext();
			Context envContext  = (Context)initContext.lookup("java:/comp/env");
			DataSource ds = (DataSource)envContext.lookup("jdbc/libraryweb");
			Connection conn = ds.getConnection();
			return conn;
			} catch (Exception ex) {
				ex.printStackTrace();
				return null;
			}
	}
}
